<template>
  <view class="list">
    <!-- <open-data type="userNickName"></open-data>
		<open-data type="userAvatarUrl"></open-data> -->
    <view @click="goLogin" class="item">登录</view>
    <button @click="goSubPage">跳转分包页面</button>
    <view class="card-list">
      <view class="card-item" @click="jumpService">
        <text class="title">企知道用户协议</text>
        <image class="img-right" src="/static/more.svg" mode="widthFix"></image>
      </view>
      <view class="card-item" @click="jumpService2">
        <text class="title">企知道隐私政策</text>
        <view class="iconfont icon-pub-youjiantou-xianmiao"></view>
        <!-- 	<image class="img-right" src="/static/more.svg" mode="widthFix"></image> -->
      </view>
    </view>
    <view>
      <image class="img" :src="userInfo.avatarUrl" mode="aspectFit"></image>
      <text class="txt">{{ userInfo.nickName }}</text>
    </view>
    <button open-type="getUserInfo" @getuserinfo="getuserinfo">
      获取用户信息
    </button>
    <!-- 	<button @click="handleUserProfile">getUserProfile</button> -->
  </view>
</template>

<script>
export default {
  data() {
    return {
      appid: "wxc031cdb559460d24",
      appid2: "wx42bfba11f6a34157",
      appSecret: "d77877eeea1fef47248ee55a0d977902",
      userInfo: {},
    };
  },
  methods: {
    goLogin() {
      uni.navigateTo({
        url: "/pages/login/login",
      });
    },
    goSubPage() {
      uni.navigateTo({
        url: "/pages/subpage/subHome/subHome",
      });
    },
    // web-view 加载的 url 需要在后台配置域名白名单
    jumpService() {
      let url = "https://apph5.qizhidao.com/agreement/service";
      let title = "企知道用户协议";
      uni.navigateTo({
        url: `/pages/webview/webview?u=${encodeURIComponent(
          url
        )}&title=${encodeURIComponent(title)}`,
      });
    },
    getuserinfo(e) {
      this.userInfo = e.detail.userInfo;
      console.log(e.detail, "e1233");
    },
    // handleUserProfile(){
    // 	uni.getUserProfile({
    // 		desc:"测试",
    // 		success:(e)=>{
    // 			console.log(e,'e9999')
    // 		}
    // 	})
    // }
  },
};
</script>

<style lang="scss">
.item {
  width: 100%;
  padding-left: 20px;
  background-color: #ccc;
  height: 80rpx;
  line-height: 80rpx;
  color: #fff;
}

.img {
  width: 80rpx;
  height: 80rpx;
  border-radius: 50%;
}

.txt {
  font-size: 30rpx;
}

.card-list {
  width: 686rpx;
  border-radius: 12rpx;
  margin-top: 40rpx;

  margin-left: auto;
  margin-right: auto;

  .card-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30rpx;
    background-color: #efefef;
    padding-left: 20rpx;
    padding-right: 20rpx;
    height: 80rpx;

    .title {
      font-size: 32rpx;
      color: #394455;
      font-weight: 500;
    }

    .img-right {
      width: 32rpx;
      height: 32rpx;
      margin-left: auto;
    }
  }
}
</style>
